import React from "react";

class Header extends React.Component{
  constructor(props){
    super(props)
    console.log(props)
    this.state = {
      title:""
    }
  }
   //创建阶段
   componentWillMount(){
    console.log("Header componentWillMount")
    this.setState({
      title:this.props.title
    })
  }

  render(){
    console.log("Header render")
    return(
      <div>
        <div>{this.state.title}</div>
      </div>
    )
  }


  componentDidMount(){
    console.log("Header componentDidMount")
  }

  componentWillReceiveProps(props){
    this.props = props;
    this.setState({
      title:this.props.title
    })
    console.log("Header componentWillReceiveProps")
  }
  shouldComponentUpdate(){
    console.log("Header shouldComponentUpdate")
    return false;
  }
  componentWillUpdate(){
    console.log("Header componentWillUpdate")
  }
  componentDidUpdate(){
    console.log("Header componentDidUpdate")
  }

  componentWillUnmount(){

  }

  componentDidCatch(){
    
  }
}

export default Header;